﻿CREATE TABLE [BILL].[Bills]
(
	[Id] INT NOT NULL PRIMARY KEY IDENTITY, 
    [CustomerId] INT NULL,
	[Datetime] DATETIME NOT NULL DEFAULT GETDATE(), 
    [Pay] FLOAT NOT NULL DEFAULT 0, 
	[Sealed] BIT NOT NULL DEFAULT 0,
    [Timestamp] DATETIME NOT NULL DEFAULT GETDATE(), 
    CONSTRAINT [FK_BILL.Bills_CAT.Customers] FOREIGN KEY ([CustomerId]) REFERENCES [CAT].[Customers]([Id]), 
)

GO

CREATE INDEX [IX_BILL.Bills_Timestamp] ON [BILL].[Bills] ([Timestamp])

GO

CREATE INDEX [IX_BILL.Bills_CustomerId] ON [BILL].[Bills] ([CustomerId])

GO

CREATE INDEX [IX_BILL.Bills_Sealed] ON [BILL].[Bills] ([Sealed])
